#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

struct BodyData
{
    BodyData()
        : weight(0)
        , fatRate(0)
        , muscleRate(0)
    {}

    double weight;
    double fatRate;
    double fatWeight;
    double muscleRate;
    double muscleWeight;
};

struct CalculateData
{
    CalculateData()
        : subWeight(0)
        , subFatWeight(0)
        , subMuscleWeight(0)
        , subWaterWeight(0)
        , fatMuscleRate(0)
        , fatMuscleWaterRate(0)
        , OneFatSub(0)
    {}

    double subWeight;
    double subFatWeight;
    double subMuscleWeight;
    double subWaterWeight;
    double fatMuscleRate;
    double fatMuscleWaterRate;
    double OneFatSub;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_m_spbOriginalWeight_valueChanged(double arg1);

    void on_m_spbOriginalFatRate_valueChanged(double arg1);

    void on_m_spbOriginalMuscleRate_valueChanged(double arg1);

    void on_m_spbNowWeight_valueChanged(double arg1);

    void on_m_spbNowFatRate_valueChanged(double arg1);

    void on_m_spbNowMuscleRate_valueChanged(double arg1);

    void on_m_btnCalculate_clicked();

private:
    Ui::MainWindow *ui;

    BodyData m_oriData;
    BodyData m_nowData;
    CalculateData m_calculateData;

    void calculate();

    void updateOriUI();
    void updateNowUI();

    void updateUI();

};
#endif // MAINWINDOW_H
